<?php

header('Content-type:text/html;charset=utf-8');
$key=$_GET['key'];
$repeat=!empty($_GET['repeat'])?$_GET['repeat']:'';
$obj=new mysql($config);

if($key&&$repeat==''){
            $sql="select * from `state` where `value`='$key'";
            $row=$obj->getOne($sql);
            if($row&&time()<$row['outtime']){

            $obj->update(array('state'=>1),array('id'=>$row['id']),'user');
            $obj->delete($row['id'],'state');
            echo '<script>alert("激活成功!");location.href="http://localhost/cms/index.php";</script>';
            }else{
            echo '<h3 style="font-size:100px;font-weight:normal;">|</h3><br/><h3 style="margin-left:100px;font-size:130px;font-weight:normal;">(</h3><br/><h3 style="font-size:100px;font-weight:normal;">|</h3><br/>';
            echo '链接失效，<a href="http://localhost/cms/index.php?c=reg&a=active&repeat=once&key='.$key.'">点此进行再次发送邮箱</a>！！';
            }
}




if($repeat=='once'){
      $sql="select `user`.* from `state` inner join `user` on `state`.id=`user`.id where `value`='$key'";
      $row=$obj->getOne($sql);
      $obj->delete($row['id'],'state');
      sendEmail($row['email'],$row['id'],1);
}










